Add new functions, c-go-list-forward, c-go-list-backward.
authorAlan Mackenzie <acm@muc.de>
Sat, 20 Jan 2007 19:22:55 +0000 (19:22 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 20 Jan 2007 19:22:55 +0000 (19:22 +0000)
lisp/progmodes/cc-defs.el

index af48eb2e21c55f581c6bc4844e40a010047f0396..8b5adfb997f4ea27b82813429910a1ee1386c85c 100644 (file)
@@ -580,6 +580,24 @@ right side of it."
 ;; Wrappers for common scan-lists cases, mainly because it's almost
 ;; impossible to get a feel for how that function works.
 
+(defmacro c-go-list-forward ()
+  "Move backward across one balanced group of parentheses.
+
+Return POINT when we succeed, NIL when we fail.  In the latter case, leave
+point unmoved."
+  `(c-safe (let ((endpos (scan-lists (point) 1 0)))
+            (goto-char endpos)
+            endpos)))
+
+(defmacro c-go-list-backward ()
+  "Move backward across one balanced group of parentheses.
+
+Return POINT when we succeed, NIL when we fail.  In the latter case, leave
+point unmoved."
+  `(c-safe (let ((endpos (scan-lists (point) -1 0)))
+            (goto-char endpos)
+            endpos)))
+
 (defmacro c-up-list-forward (&optional pos limit)
   "Return the first position after the list sexp containing POS,
 or nil if no such position exists.  The point is used if POS is left out.